const { sequelize } = require("@core/db");
const { Sequelize, Model } = require("sequelize");

class Product extends Model {}

Product.init(
  {
    product_id: {
      type: Sequelize.INTEGER,
      primaryKey: true,
      autoIncrement: true,
    },
    product_name: {
      type: Sequelize.STRING,
      comment: "产品名称",
    },
    product_point: {
      type: Sequelize.INTEGER,
      comment: "产品积分",
    },
    proportion: {
      type: Sequelize.DataTypes.DECIMAL(10, 5),
      comment: "返积分比例",
    },
    remark: {
      type: Sequelize.STRING,
      comment: "备注",
    },
  },
  {
    sequelize,
    tableName: "product",
  }
);

module.exports = {
  Product,
};
